FROM registry.cn-shanghai.aliyuncs.com/yhjwl/golang:v1.0.0 as builder

WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server
COPY . .

RUN go env -w GO111MODULE=on \
    && go env -w GOPROXY=https://goproxy.cn\
    && go env -w CGO_ENABLED=0 \
    && go env \
    && go mod tidy \
    && go build -o server .

FROM registry.cn-shanghai.aliyuncs.com/yhjwl/alpine:v1.0.0

# 设置时区
ENV TZ=Asia/Shanghai

WORKDIR /go/src/github.com/flipped-aurora/gin-vue-admin/server

COPY --from=0 /go/src/github.com/flipped-aurora/gin-vue-admin/server/server ./
COPY ./etc/config.yaml ./etc/

EXPOSE 9999
ENTRYPOINT ./server